<template>
  <div class="app">
    <div class="link-list">
      <router-link
          class="link-item"
          active-class="link-active"
          v-for="(item, index) in routerList"
          :key="index"
          :to="item.to"
      >
        {{ item.label }}
      </router-link>
    </div>
    <div>
      <router-view v-slot="{ Component }">
        <keep-alive>
          <component :is="Component" />
        </keep-alive>
      </router-view>
    </div>
  </div>
</template>

<script setup>
import {reactive} from "vue"

const routerList = reactive([
  {
    label: "开始",
    to: {
      name: "Start"
    }
  },
  {
    label: "樱花飘落",
    to: {
      name: "FloatDownDemo"
    }
  },
  {
    label: "罗盘时钟",
    to: {
      name: "CompassClockDemo"
    }
  },
  {
    label: "代码雨",
    to: {
      name: "CodeRainDemo"
    }
  },
  {
    label: "旋转卡片",
    to: {
      name: "RotateCardsDemo"
    }
  },
  {
    label: "烟花",
    to: {
      name: "FireWorksDemo"
    }
  }
])
</script>

<style>
.app {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: 200px 1fr;
}
.app .link-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background-image: linear-gradient( 135deg, #3B2667 10%, #BC78EC 100%);
}
.link-list::-webkit-scrollbar {
  display: none;
}
.link-list .link-item {
  font-weight: 600;
  line-height: 2;
  text-decoration: none;
  padding: 0 1.5em;
  text-overflow: ellipsis;
  overflow: hidden;
  flex: none;
  color: #ffffff;
}
.link-list .link-item:hover {
  background-image: linear-gradient( 135deg, #81FBB8 10%, #28C76F 100%);
  color: #3B2667;
}
.link-list .link-active {
  background-image: linear-gradient( 135deg, #69FF97 10%, #00E4FF 100%);
  color: #3B2667;
}
</style>